1、輸入一個整數,求其逆序數
```
def reversed1(number):
length = len(number)
out = ''
for i in range(len(number)):
out += number[length - 1 - i]
return out
def reversed2(number):
number = int(number)
out = 0
while number != 0:
out = out * 10 + number % 10
number = number // 10
return out
if __name__ == '__main__':
number = input('input a number:')
out1 = reversed1(number)
out2 = reversed2(number)
print(out1)
print(out2)
```
2、將一個正整數分解質因數
def sp1(number):
start = str(number)
out = []
i = 2
while number != 1:
while number % i == 0:
number //= i
out.append(str(i))
i += 1
print(start + '=' + '*'.join(out))
def sp2(number):
print(str(number) + '=', end='')
i = 2
while number != 1:
while number % i ==0:
number //= i
if number == 1:
print('{:d}'.format(i), end='')
else:
print('{:d}*'.format(i), end='')
i += 1
if __name__ == '__main__':
number = eval(input('input a number:'))
sp1(number)
sp2(number)
```